Skip to content

fix: align fast parser with default parser on whitespace and multiline quoted values - #1047

Closed
vaibhavmashal wants to merge 1 commit into
motdotla:masterfrom
vaibhavmashal:fix/fast-parser-whitespace-multiline-parity
Closed

vaibhavmashal wants to merge 1 commit into
motdotla:masterfrom
vaibhavmashal:fix/fast-parser-whitespace-multiline-parity

Conversation

@vaibhavmashal

Copy link
Copy Markdown

Aligns the fast parser (parse(src, { fast: true })) with the default regex parser to address divergences described in #1043:

Summary of Changes

  1. Multiline Quoted Values Across Blank Lines After Separator:
    The default regex parser allows leading whitespace (including newlines) before a quoted value (e.g., A=\n\n"hello\nworld"). The scanner now detects when a newline is crossed after the separator before encountering a quote, parsing the quoted value across multiple lines while matching empty fallback behavior if trailing junk exists.

  2. Whitespace Parity (\f, \v, \u00A0):
    Expanded fast scanner whitespace detection to include Form Feed (\f / 12), Vertical Tab (\v / 11), Non-breaking Space (\u00A0 / 160), BOM (\uFEFF / 65279), Space ( / 32), Tab (\t / 9), and Newline (\n / 10).

  3. Trailing Junk Handling After Closing Quote:
    Aligned raw fallback behavior when trailing junk follows a closing quote on the same line (e.g. TOKEN="abc" oops).

  4. Test Coverage:
    Added tests/test-fast-parity.js to ensure parity across all aforementioned cases.

Fixes #1043

…e quoted values

- Handle whitespace characters (\f, \v, \u00A0) in fast parser scanner matching default regex behavior

- Support multiline quoted values across blank lines after separator

- Align trailing junk fallback behavior after closing quote

- Add unit tests verifying parity between parse() and parse(..., { fast: true })

Fixes #1043
Copilot AI lite review requested due to automatic review settings August 30, 2026 05:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@motdotla

Copy link
Copy Markdown
Owner

fixing here: #1056

@motdotla motdotla closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fast parser diverges from the default parser (silent value loss)

3 participants